<template>
	<div>
		<el-button type="primary" @click="dialogRef?.openDialog">Open Dialog</el-button>
		<Dialog ref="dialogRef"></Dialog>
		<el-button @click="handleNewWindow">打开新窗口</el-button>
		<el-button @click="handleLogout">退出登录</el-button>
	</div>
</template>

<script setup lang="ts">
import Dialog from '../components/Dialog.vue'
import { ref } from 'vue'
const dialogRef = ref<InstanceType<typeof Dialog>>()
/**
 * 打开新窗口
*/
const handleNewWindow = () => {
	window.ipcRenderer.invoke('openNewWindow', {
		windowId: 'img',
		title: '图片查看',
		path: '/showImg',
		data: {
			a: 100,
			b: 200
		}
	})
}
/**
 * 退出登录
*/
const handleLogout = () => {
	window.ipcRenderer.invoke('logout')
}
</script>

<style scoped></style>
